<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>

<h2>${pageTitle}</h2>
<c:if test="${not empty foutMelding}">
    <!-- Mochten er foutmeldingen zijn, dan worden ze hier getoond -->
    <p>${foutMelding}</p>
</c:if>
<c:choose>
    <c:when test="${empty user.userId}">
        <!-- Als er geen id is meegegeven, ga je een gebruiker toevoegen -->
        <form id="nieuweGebruiker" action="new" method="post">
        </c:when>
        <c:otherwise>
            <!-- Anders ga je een gebruiker wijzigen -->
            <form id="wijzigenGebruiker" action="edit" method="post">
            </c:otherwise>
        </c:choose>
        <p>
            <c:if test="${not empty user.userId}">
                <!-- Het id wordt meegestuurd, om te bepalen welke gebruiker je gaat wijzigen -->
                <input type="hidden" name="id" id="id" value="${user.userId}"></input>
            </c:if>
        <table border="0">
            <tr>
                <td><label for="firstname">First Name</label></td>
                <td><input type="textfield" id="firstname" name="firstname" value="${user.userFirstName}"></input></td>
            </tr>
            <tr>
                <td><label for="lastname">Last Name</label></td>
                <td><input type="textfield" id="lastname" name="lastname" value="${user.userLastName}"></input></td>
            </tr>
            <tr>
                <td><label for="username">Username</label></td>
                <td><input type="textfield" id="username" name="username" value="${user.userName}"></input></td>
            </tr>
            <tr>
                <td><label for="email">E-mail</label></td>
                <td><input type="textfield" id="email" name="email" value="${user.userEmail}"></input></td>
            </tr>
            <tr>
                <td><label for="password">Password</label></td>
                <td><input type="password" id="password" name="password" value="${user.password}"></input></td>
            </tr>
            <tr>
                <td><label for="password">Repeat Password</label></td>
                <td><input type="password" id="password-repeat" name="password-repeat" value="${user.password}"></input></td>
            </tr>
            
            <tr>
                <td> <label for="user">Type of user:</label></td>
                <td>
                    <select name="usertype">
                        <option value="1">Student</option>
                        <option value="2">Teacher</option>
                        <option value="3">Administrator</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td> <label for="landoforigin">Land of Origin:</label></td>
                <td>
                    <select name="landoforigin">
                        <option value="0">The Netherlands</option>
                        <option value="1">England</option>
                    </select>
                </td>
            </tr>
        </table>
        </p>
        <p>
            <input class="submit" type="submit" value="${buttonTitle}">
        </p>
    </form>